﻿@model Orchard.CounterField.Fields.CounterField
@using Orchard.Utility.Extensions;
@using Orchard.CounterField.Settings;
@{
    Style.Include("datetime.css");

    Script.Require("jQuery").AtFoot();
    Script.Require("jQueryUI_Core").AtFoot();
    Script.Require("jQueryUI_Widget").AtFoot();
    Style.Require("jQueryUI_Orchard").AtFoot();
    
    var settings = Model.PartFieldDefinition.Settings.GetModel<CounterFieldSettings>();
    //string type = "number";
}
@*@{

    if (settings.Type.ToString().Equals("Date"))
    {
        type = "date";
        using (Script.Foot())
        {
            Display.DatePickerLocalization();
     
    <script type="text/javascript">
        //<![CDATA[
        $(function () {
            $("#@Html.FieldIdFor(m => m.StartValue)").datepicker({ showAnim: "" });
            $("#@Html.FieldIdFor(m => m.StopValue)").datepicker({ showAnim: "" });
        })
        //]]>
    </script>
        }

    }
}*@
<fieldset>
    <div>
        <h2 for="@Html.FieldIdFor(m => m.StartValue)" @if (settings.Required)
                                                      { <text>class="required"</text> }>@Model.DisplayName</h2>


        <div>
            <label>@T("Counter Direction")</label>
            <select id="@Html.FieldIdFor(m => m.Direction)" name="@Html.FieldNameFor(m => m.Direction)">
                @Html.SelectOption("up", Model.Direction == "up", T("up").ToString())
                @Html.SelectOption("down", Model.Direction == "down", T("down").ToString())
            </select>
            <span class="hint">@T("Defines which direction the counter will increment in.")</span>
        </div>



            <label>@T("Start Value")</label>
            <input type="text" id="@Html.FieldIdFor(m => m.StartValue)" name="@Html.FieldNameFor(m => m.StartValue)" value="@Model.StartValue"@if (settings.Required){<text> required="required"</text>} class="text-medium" />
            @Html.ValidationMessageFor(m => m.StartValue)
            
            <label>@T("Stop Value")</label>
            <input type="text" id="@Html.FieldIdFor(m => m.StopValue)" name="@Html.FieldNameFor(m => m.StopValue)" value="@Model.StopValue"@if (settings.Required){ <text> required="required"</text>}  class="text-medium"  />
            @Html.ValidationMessageFor(m => m.StopValue)
            <span class="hint">@T("Start and Stop values must be given in the format specified in the field settings.")</span>
        
    



        <span class="hint">@settings.Hint</span>
    </div>
</fieldset>
